Skip to content

feat: add deterministic CLEF Tetris engine - #76

Open
geier wants to merge 2 commits into
mainfrom
feature/issue-71
Open

geier wants to merge 2 commits into
mainfrom
feature/issue-71

Conversation

@geier

@geier geier commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a framework-independent TypeScript Tetris engine with deterministic seven-bag generation, normalized SRS orientations, centered spawn checks, hold handling, line clears, scoring, and board metrics
  • enumerate every direct hard-drop terminal placement and assign state-bound stable option IDs
  • map game states and candidates to the CLEF-Flash SystemOne choice contract and reject malformed, unknown, or stale responses
  • add focused coverage for physics, metrics, bag composition, hold transitions, state immutability, scoring, top-out, and request/response handling

Testing

  • npm ci
  • npm run typecheck
  • npm test (23 passed)
  • npm run lint
  • npm run build
  • npm audit --audit-level=high (0 vulnerabilities)

Notes

Closes #71
Related to #69

@geier
geier requested a balanced review from Copilot October 1, 2026 18:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The declared Node compatibility includes versions unsupported by the locked test and lint tooling.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds a deterministic, framework-independent Tetris engine and CLEF SystemOne decision contract.

Changes:

  • Implements seeded seven-bag gameplay, placement enumeration, hold, scoring, and metrics.
  • Adds request/response mapping with stale-choice rejection.
  • Adds TypeScript tooling and focused tests.
File Description
ui/​tsconfig.json Configures strict TypeScript checks.
ui/​src/​game/​types.ts Defines game state and placement types.
ui/​src/​game/​tetrominoes.ts Defines normalized tetromino orientations.
ui/​src/​game/​random.ts Implements seeded seven-bag generation.
ui/​src/​game/​index.ts Exports the game API.
ui/​src/​game/​engine.ts Implements game transitions and placements.
ui/​src/​game/​board.ts Implements board physics and metrics.
ui/​src/​game/​__tests__/​random.test.ts Tests bag composition and seeds.
ui/​src/​game/​__tests__/​engine.test.ts Tests transitions, scoring, and determinism.
ui/​src/​game/​__tests__/​board.test.ts Tests board physics and metrics.
ui/​src/​api/​systemone.ts Maps states and decisions to SystemOne.
ui/​src/​api/​index.ts Exports the API contract.
ui/​src/​api/​__tests__/​systemone.test.ts Tests request and response handling.
ui/​README.md Documents engine behavior and commands.
ui/​package.json Defines scripts, dependencies, and Node support.
ui/​package-lock.json Locks JavaScript dependencies.
ui/​eslint.config.js Configures JavaScript and TypeScript linting.
ui/​.gitignore Ignores generated and installed files.
Files not reviewed (1)
  • serving/clef-flash/ui/package-lock.json: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread serving/clef-flash/ui/package.json Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement the deterministic Tetris engine and CLEF policy contract

2 participants